package com.aix.demo.activity;

import android.os.Bundle;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.Toast;

import com.aix.android.framework.activity.BaseActivity;
import com.aix.demo.R;
import com.aix.demo.view.MySwitch;

public class SwitchActivity extends BaseActivity {
	
	private MySwitch switch1;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_switch);
		
		switch1 = (MySwitch) findViewById(R.id.switch1);
		
		switch1.setOnCheckedChangeListener(new OnCheckedChangeListener() {
			
			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				if (isChecked) {
					showToast("checked", Toast.LENGTH_SHORT);
				} else {
					showToast("unchecked", Toast.LENGTH_SHORT);
				}
			}
		});
	}
	
}
